package com.testing.redboy.fragment;


import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.testing.redboy.FirstActivity;
import com.testing.redboy.MapActivity;
import com.testing.redboy.R;

public class MoreFragment extends Fragment implements View.OnClickListener {
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";

    private String mParam1;
    private String mParam2;
    private RelativeLayout re_baidu;
    private RelativeLayout re_erweima;
    private RelativeLayout re_login;


    public MoreFragment() {
    }

    public static MoreFragment newInstance(String param1, String param2) {
        MoreFragment fragment = new MoreFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_more, container, false);

        initView(v);

        re_baidu.setOnClickListener(this);
        re_erweima.setOnClickListener(this);
        re_login.setOnClickListener(this);


        return v;
    }

    private void initView(View v) {
        re_baidu = (RelativeLayout) v.findViewById(R.id.re_baidu);
        re_erweima = (RelativeLayout) v.findViewById(R.id.re_erweima);
        re_login = (RelativeLayout) v.findViewById(R.id.re_login);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.re_baidu:
                Intent intent = new Intent(getActivity(), MapActivity.class);
                startActivity(intent);
                break;
            case R.id.re_erweima:
                Intent intent2 = new Intent(getActivity(), FirstActivity.class);
                intent2.putExtra("fk", 9);
                startActivity(intent2);
                break;
            case R.id.re_login:
                Intent intent3 = new Intent(getActivity(), FirstActivity.class);
                intent3.putExtra("fk", 10);
                startActivity(intent3);
                break;
        }
    }
}
